#ifndef A8_MYSQL_H
#define A8_MYSQL_H

#include <string>
#include <mysql.h>

namespace a8
{
  namespace Mysql
  {
    class Connection
    {
    priate:
      MYSQL *mConn;
      std::string mHost;
      int mPort;
      std::string mUserName;
      std::string mPwd;
      std::string mDataBase;
      BOOL mConnected;
    public:
      Connection():mConn(NULL),
		   mHost(""),
		   mPort(0),
		   mUserName(""),
		   mPwd(""),
		   mDataBase(""),
		   mConnected(FALSE)
      {
	mConn = mysql_init(NULL);
	assert(mConn);
      }
      ~Connection()
      {
	if(mConn)
	  mysql_close(mConn);
      }
      const MYSQL* getConn() { return mConn; }
      BOOL Connected() { return mConnected; }
      void Connect(const std::string& host, int port, 
		  const std::string& userName, const std::string& pwd, const std::string& dataBase)
      {
	mHost = host;
	mPort = port;
	mUserName = userName;
	mPwd = pwd;
	mDataBase = dataBase;
	//if(mysql_real_connect(mConn, mHost.c_str(), 
      }
		  
    }

    class Query
    {
    private:
      a8::Mysql::Connection *mConnection;
    public:
      Query(a8::Mysql::Connection *connection) { mConnection = connection; }

      a8::Mysql::Connection* getConnection() { return mConnection;}
      void setConnection(a8::Mysql::Connection *connection) { mConnection = connection; }
      int RecordCount()
      {
	return 0;
      }
      int getInt()
      {
	return 0;
      }
      std::string getString()
      {
	return "";
      }
      float getFloat()
      {
	return 0.0f;
      }
      BOOL Eof()
      {
	return FALSE;
      }
      void First()
      {
      }
      void Last()
      {
      }
      void Prior()
      {
      }
      void Next()
      {
      }
    }
  }

}

#endif
